<template>
  <div class="lc-editor">
    <vue-ueditor-wrap
      v-model="innerValue"
      editor-id="editor"
      :config="props.editorConfig"
      :editorDependencies="['ueditor.config.js', 'ueditor.all.js']"
      style="height: 500px; width: 1200px"
    />
  </div>
</template>

<script lang="ts" setup>
import { ref, watch } from "vue";
import "@wangeditor/editor/dist/css/style.css"; // 引入 css

const props = defineProps({
  modelValue: {
    type: [Number, String],
    default: "",
  },
  editorConfig: {
    type: Object,
    default: () => {},
  },
});

watch(
  () => props.modelValue,
  (newValue) => {
    innerValue.value = newValue;
  },
);

const innerValue = ref(props.modelValue);
</script>
